#include "DaterUserSelectWindow.h"
#include "CEGUI.h"
#include "DaterUserManager.h"

UserSelectWindow::UserSelectWindow(const CEGUI::String& id_name, CEGUI::Window* parent):
	BaseWindow(parent)
{
	using namespace CEGUI;

	_root = CEGUI::WindowManager::getSingleton().loadWindowLayout("UserSelect.layout", id_name);

	_root->setDestroyedByParent(false);

	//ListboxTextItem* itm;
	WindowManager& winMgr = WindowManager::getSingleton();

	//char c[20];
	const CEGUI::Image *sel_img = &ImagesetManager::getSingleton().get("WindowsLook").getImage("HeaderMainBrush");

	

	_name = _root->getName().c_str();

	_type = "static";

	_root->getChild("UserSelectWindow/Submit")->
        subscribeEvent(PushButton::EventClicked, Event::Subscriber(&UserSelectWindow::handle_Submit, this));

	showWindow();
}

UserSelectWindow::~UserSelectWindow()
{
    // destroy the windows that we loaded earlier
    CEGUI::WindowManager::getSingleton().destroyWindow(_root);
}

void UserSelectWindow::showWindow()
{
	_parent->addChildWindow(_root);
	_root->activate();
}

void UserSelectWindow::hideWindow()
{
	_root->deactivate();
	_parent->removeChildWindow(_root);
}

bool UserSelectWindow::handle_Submit(const CEGUI::EventArgs& args)
{
	
	return true;
}